/*    This file is part of ilk.
 *
 *    Ilk is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    Ilk is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public License
 *    along with ilk.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef ILK_EXAMINE_H
#define ILK_EXAMINE_H

/*
Include:
#include <dirent.h>
#include <rid.h>
#include <stdint.h>

#include <fn85.h>
#include <rid_fn85.h>

#include <unfy/unfy.h>
#include <rls/rls.h>
#include <rls/rlsp.h>

#include <nit/list.h>
#include <nit/set.h>
#include <nit/map.h>
#include <nit/err.h>
#include <nit/file.h>
#include <nit/buf.h>
#include <nit/gap.h>

#include <ilk/utilize.h>

#include <ilk/examine.h>
*/

#ifndef STYLE_9
#include <rid_fn85.h>
#include <rls/rlsp.h>

#include "ilk.h"
#endif

typedef char Ilk_rule_path[sizeof("rules/") - 1 + sizeof(Rid_fn85_path)];

typedef char Ilk_meta_path[sizeof("metas/") - 1 + sizeof(Rid_fn85_path)];

typedef char Ilk_srch_path[39];

/* get path */

void
ilk_rule_path(Ilk_rule_path path, const Rid id);

void
ilk_meta_path(Ilk_meta_path path, const Rid id);

void
ilk_srch_path(Ilk_srch_path path, uint64_t srch_cnt);

/* get from path */

int
ilk_path_grp(Ilk_grp *grp, const char *path, int check, Ilk_sys *sys);

void
ilk_grp_dispose(Ilk_grp *grp, Ilk_sys *sys);

int
ilk_path_meta(Ilk_meta *meta, const char *path, int check, Ilk_sys *sys);

int
ilk_path_srch(Rls_srch **srch_ref, const char *path, Ilk_sys *sys);

int
ilk_path_meta_dep(Ilk_sys *sys, const char *path, uint64_t srch_cnt);

int
ilk_meta_ser(Ilk_meta *meta, unsigned char **buf_ref,
	      size_t *size, size_t *pos);

const char *
ilk_meta_deserable(const unsigned char *buf, size_t *pos,
		    const size_t max);

int
ilk_meta_deser(Ilk_meta *meta, const unsigned char *buf, size_t *pos);

#endif
